package cn.com.open.itembank.controller;

import cn.com.open.itembank.entity.QuestionType;
import cn.com.open.itembank.service.QuestionTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by lucky on 2017/9/4.
 */
@RestController
@RequestMapping("/questionType")
public class QuestionTypeController {

    @Autowired
    private QuestionTypeService service;

    /**
     * 根据题型id获取题型信息.
     *
     * @param id 题型id
     * @return 题型信息
     */
    @GetMapping(value = "/{id}")
    public QuestionType getQuestionType(@PathVariable(value = "id") String id) {
        return service.getQuestionType(id);
    }

    /**
     * 根据大题id获取题型信息.
     *
     * @param sectionId 大题id
     * @return 题型信息
     */
    @GetMapping(value = "/section/{sectionId}")
    public QuestionType getQuestionTypeBySectionId(@PathVariable(value = "sectionId") String sectionId) {
        return service.getQuestionTypeBySectionId(sectionId);
    }

}
